import React from 'react'
import { connect } from 'dva'
import { Button } from 'antd'
import tags from '../../models/tags'
const Dva = function (props) {
  const { dispatch } = props
  const list = props.tags.tagsList.list || []
  const getData = () => {
    dispatch({
      type: 'tags/fetchTags',
      payload: null
    })
  }
  return (
    <div>
      <Button onClick={getData}>获取数据</Button>
      <div style={{ overflow: 'auto', height: '150px' }}>
        {
          list.map((item, index) => (<p key={index}>{item.name}</p>))
        }
      </div>
    </div>
  )
}

export default connect(({ tags }) => ({ tags }))(Dva)
